﻿using System;
using System.Web.UI;

namespace AjaxDataControls
{
    public class CustomScriptControlDescriptor : ScriptControlDescriptor
    {
        protected string id;

        public string ServerID
        {
            get { return this.id; }
            set { this.id = value; }
        }

        public CustomScriptControlDescriptor(string id, string type, string elementID) : base(type, elementID)
        {
            this.ServerID = id;
        }

        protected override string GetScript()
        {
            return string.Format("{0}\n{1} = $find('{2}');", base.GetScript(), this.ServerID, this.ClientID);
        }
    }
}
